<% wrap_layout :layout do %>
<div class="container">
  <div class="row">
    <div id="docs-sidebar" class="col-sm-4 col-md-3 col-xs-12 hidden-print g-type-body-small" role="complementary">
      <a href="#inner" id="screenreader-skip" class="sr-only sr-only-focusable">Skip to content</a>
      <a href="#inner" id="mobile-skip" class="visible-xs">(Skip to content ⤵︎)</a>
      <div id="controls-placeholder" style="display: none;"></div>
      <div id="sidebar-header-grid"></div>
      <% if content_for?(:sidebar) %>
      <%
        sidebar_text = yield_content(:sidebar)
        fuzzy_url = current_page.url.sub(%r{(/|/index\.html)$}, '/(index\.html)?')
        sidebar_text.gsub!(/href=["']#{fuzzy_url}['"]/, '\0 class="current-page"')
      %>
      <%= sidebar_text %>
      <% end %>
    </div>

    <%
      external_docs_links = {
        '/docs/providers/alicloud/index.html'       => 'https://registry.terraform.io/providers/hashicorp/alicloud/',
        '/docs/providers/archive/index.html'        => 'https://registry.terraform.io/providers/hashicorp/archive/',
        '/docs/providers/aws/index.html'            => 'https://registry.terraform.io/providers/hashicorp/aws/',
        '/docs/providers/azuread/index.html'        => 'https://registry.terraform.io/providers/hashicorp/azuread/',
        '/docs/providers/azurerm/index.html'        => 'https://registry.terraform.io/providers/hashicorp/azurerm/',
        '/docs/providers/azurestack/index.html'     => 'https://registry.terraform.io/providers/hashicorp/azurestack/',
        '/docs/providers/ciscoasa/index.html'       => 'https://registry.terraform.io/providers/hashicorp/ciscoasa/',
        '/docs/providers/consul/index.html'         => 'https://registry.terraform.io/providers/hashicorp/consul/',
        '/docs/providers/dns/index.html'            => 'https://registry.terraform.io/providers/hashicorp/dns/',
        '/docs/providers/external/index.html'       => 'https://registry.terraform.io/providers/hashicorp/external/',
        '/docs/providers/github/index.html'         => 'https://registry.terraform.io/providers/hashicorp/github/',
        '/docs/providers/google/index.html'         => 'https://registry.terraform.io/providers/hashicorp/google/',
        '/docs/providers/helm/index.html'           => 'https://registry.terraform.io/providers/hashicorp/helm/',
        '/docs/providers/http/index.html'           => 'https://registry.terraform.io/providers/hashicorp/http/',
        '/docs/providers/kubernetes/index.html'     => 'https://registry.terraform.io/providers/hashicorp/kubernetes/',
        '/docs/providers/local/index.html'          => 'https://registry.terraform.io/providers/hashicorp/local/',
        '/docs/providers/nomad/index.html'          => 'https://registry.terraform.io/providers/hashicorp/nomad/',
        '/docs/providers/null/index.html'           => 'https://registry.terraform.io/providers/hashicorp/null/',
        '/docs/providers/oci/index.html'            => 'https://registry.terraform.io/providers/hashicorp/oci/',
        '/docs/providers/opc/index.html'            => 'https://registry.terraform.io/providers/hashicorp/opc/',
        '/docs/providers/oraclepaas/index.html'     => 'https://registry.terraform.io/providers/hashicorp/oraclepaas/',
        '/docs/providers/random/index.html'         => 'https://registry.terraform.io/providers/hashicorp/random/',
        '/docs/providers/template/index.html'       => 'https://registry.terraform.io/providers/hashicorp/template/',
        '/docs/providers/terraform/index.html'      => 'https://registry.terraform.io/providers/hashicorp/terraform/',
        '/docs/providers/tfe/index.html'            => 'https://registry.terraform.io/providers/hashicorp/tfe/',
        '/docs/providers/tls/index.html'            => 'https://registry.terraform.io/providers/hashicorp/tls/',
        '/docs/providers/vault/index.html'          => 'https://registry.terraform.io/providers/hashicorp/vault/',
        '/docs/providers/vsphere/index.html'        => 'https://registry.terraform.io/providers/hashicorp/vsphere/',
      }
    %>
    <div id="inner" class="col-sm-8 col-md-9 col-xs-12" role="main">
      <div id="inner-header-grid">
        <div id="external-docs-link">
          <% if external_docs_links[current_page.url] %>
            <a href="<%= external_docs_links[current_page.url] %>">View on Terraform Registry <span class="glyphicon glyphicon-new-window" aria-hidden="true" /></a>
          <% end %>
        </div>
      </div>
      <%= yield %>
    </div>
  </div>
</div>
<% end %>
